package cate.game.fight.hallow;

import cate.common.table.d.GDAttr;
import cate.game.attr.FightAttr;
import cate.game.play.part.BattleHallow;
import cate.game.play.support.PlayBuildContextWith;
import cate.game.role.Role;
import cate.game.role.res.leader.hallows.Hallow;
import easy.java.dev.note.NoteClass;

@NoteClass("战斗圣器builder")
public class BattleHallowBuilder extends PlayBuildContextWith {

	public BattleHallow build(Role role, Hallow hallow, boolean deputy) {
		BattleHallow battleHallow = new BattleHallow();
		battleHallow.type = hallow.type;
		battleHallow.skinId = hallow.skinId;
		if (role != null && !deputy) {
			battleHallow.teamAttr = role.getRes().leader.hallows.getAttr(hallow.type);
		}
		double skillDamage = hallow.getSkillDamage(ctx, deputy);
		if (skillDamage > 0) {
			battleHallow.setAttr(new FightAttr(GDAttr.ATT, skillDamage));
		}
		battleHallow.setSkills(hallow.getSkills(ctx, deputy));
		return battleHallow;
	}
}
